package org.project.d.network.msg.serializer;

import org.apache.commons.lang3.SerializationException;

/**
 * @author lin
 * @version V1.0
 * @description
 * @date 2020/6/12 12:12 下午
 */
public class NoSerialization implements Serialization {


    @Override
    public byte[] serialized(Object object) {
        if (object instanceof byte[]){
            return ((byte[]) object);
        }
        throw new SerializationException("if you use Serialization type is NoSerialization must obj is byte[] but obj is "+object.getClass());
    }

    @Override
    public <T> T deserialized(byte[] body, Class<T> tClass) {
        return ((T) body);
    }


}
